<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
		<title>预约</title>
		<meta http-equiv="expires" content="0">
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<link rel="stylesheet" href="../../../css/reset.css" />
		<link rel="stylesheet" href="../../../css/mui.min.css" />
		<link rel="stylesheet" href="../../../css/mui.picker.css" />
		<link rel="stylesheet" href="../../../css/mui.poppicker.css" />
		<link rel="stylesheet" href="../../../css/iconfont.css" />
		<link rel="stylesheet" href="../../../css/cmms.css" />
		<link rel="stylesheet" href="../../../css/doctor/bespeak.css" />
	</head>
	<body>
		<div class="mui-content" id="bespeak" v-cloak>
			<section class="panel doctor-msg">
				<div class="doctor-name">
					<div class="overflow">
						<span class="left">{{msg.doctorName}}</span>
					</div>
					<p>{{msg.hospitalName}}</p>
				</div>
				<div class="doctor-addr overflow">
					<div class="left"><i class="iconfont icon-dizhi"></i></div>
					<div class="left">{{msg.hospitalAddress}}</div>
				</div>
			</section>
			<section class="panel overflow bespeak-time" @tap="selectDate">
				<span class="left">上门时间</span>
				<i class="iconfont icon-chakangengduo right"></i>
				<span class="right">{{dateTime}}</span>
			</section>
			<a :href="'tel:'+msg.phone">
				<section class="panel btn-gray concat-saler">
						<i class="iconfont icon-dianhua1 basic-color"></i>联系业务员
				</section>
			</a>
			<section class="panel btn-gray submit-bespeak" @tap="bespeak">
				提交预约
			</section>
		</div>
		<script src="../../../js/mui.min.js?time=123465"></script>
		<script src="../../../js/mui.picker.js?time=123465"></script>
		<script src="../../../js/mui.poppicker.js?time=123465"></script>
		<script src="../../../js/vue.js?time=123465"></script>
		<script src="../../../js/cmms.js?time=333"></script>
		<script>
			new Vue({
				el:"#bespeak",
				data:{
					msg:"",
					dateTime:'am-上午'
				},
				mounted(){
					this.init();
				},
				methods:{
					init(){
						let _this = this;
						AT.muiAjaxDoctor('/clinic-doctor/doctor/get','post',{},function(res){
//							console.log(res)
							_this.msg = res;
						})
					},
					selectDate(){
						let _this = this;
						var datePicker = new mui.PopPicker();
							datePicker.setData([{value:'am',text:'am-上午'},{value:'pm',text:'pm-下午'}]);
							datePicker.show(function(items) {
								_this.dateTime = items[0].text;
							});
					},
					//预约
					bespeak(){
						let _this = this ;
						AT.muiAjaxDoctor('/clinic-doctor/doctor/add','post',{
							  "appointmentPreiod": _this.dateTime,
							  "doctorId": _this.msg.doctorId,
							  "hospitalId": _this.msg.hospitalId,
							  "saleId": _this.msg.saleId,
						},function(res){
//							console.log(res)
							mui.toast(res);
							setTimeout(function(){
								location.replace('../index.html')
							},1500)
						})
					}
				}
			})
		</script>
	</body>
</html>
